-
Notifications
You must be signed in to change notification settings - Fork 64
Add version property to DurableOrchestrationContext class #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
849dbe7
to
86326ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a version
property on the DurableOrchestrationContext
so orchestrator functions can detect their configured version, updates tests to cover this behavior, and adds a sample app showing how to use it.
- Extracts the first
ExecutionStarted
event’s version and exposes it viacontext.version
. - Adds unit tests to verify version detection and fallback to
None
. - Provides a sample Function app and configuration demonstrating versioned orchestrations.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/models/test_DurableOrchestrationContext.py | Added tests for extracting version from history events. |
samples-v2/orchestration_versioning/requirements.txt | Added dependencies for the versioning sample. |
samples-v2/orchestration_versioning/host.json | Configured "defaultVersion" under durableTask . |
samples-v2/orchestration_versioning/function_app.py | Demonstrated branching logic on context.version . |
azure/durable_functions/models/DurableOrchestrationContext.py | Implemented _version field, version property, and extraction. |
Comments suppressed due to low confidence (1)
samples-v2/orchestration_versioning/function_app.py:5
- [nitpick] Variable
myApp
uses camelCase, which deviates from PEP8 snake_case conventions. Consider renaming tomy_app
orapp
for consistency.
myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Add version property to DurableOrchestrationContext class
Add 'version' property to the
context
object passed to orchestrator functions.As a result, Python Functions users will be able to specify a version in host.json:
and check the orchestration version in their orchestrator functions in order to keep them backward compatible, for example:
Note: Microsoft.Azure.WebJobs.Extensions.DurableTask 3.1.0+ is required for this to work properly.